package com.itheima.stock.test;

import org.checkerframework.checker.units.qual.A;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.password.PasswordEncoder;

@SpringBootTest
public class PasswordEncoderPasswordEncoder {


    @Autowired
    private PasswordEncoder passwordEncoder;

    //密码加密  $2a$10$MAg015rlo5j1LjON5QIj/uB40TYidePfZG5QrPMFkzJSqdCoHYmAS
    //$2a$10$ipo22vaCA.PvDqB78vhUueRXEtgDouwHEUQfTvNyyuIRNcUBixipS
    //$2a$10$aTItxxf1AzlNsjgZTDwo9uEZ7McoYNye0n1KzshpBaSI0YTlsbyUW
    //$2a$10$CfNb7.dSIencr.aeFEaKXuPkGiT0IvxKsliKDdxCF5FMEOP7CQ6R6
    //$2a$10$OJjxSoepP/9NcoZVCd3.ZeY.mogXoMRpA2aUxb.85Ran7svCbW7ti
    //$2a$10$OnrwfxsVBr/QqC.XCOILoOWHNqBQuVBDmnC.SaYlzUEFFJdaqmULW
    //$2a$10$lzWzyKqkFtmGZ4JB0.jZue2XRYrNjfMLFeyDRSonImB7Zj0PcgwnW
    //$2a$10$vo2OeCtxY3IOMipulVtBk.iaXyBrrpD2XOCDuDXbbJJlnrwVAkf9S
    //$2a$10$WIcTHhCbp.U8nDSapbSnP.vrBI83v40RRafRiwRBkqWvCN/.L8ciS
    //$2a$10$25WYxZkoL9XxRyQmkcV/ne8v32HUTEfkDn/wSoS82s16Sy2G1j5za
    //$2a$10$8fObdRO/9CJecgdNdwW78ePDi7DEofHzvrooXar.SquDba5lurXeG
    //security密码加密解密原理
    @Test
    public void test01() {
        for (int i = 0; i < 10; i++) {
            String encode = passwordEncoder.encode("123456");
            System.out.println(encode);
        }
    }
    //ciphertext 密文
    @Test
    public void test02() {
        String ciphertext = "$2a$10$WIcTHhCbp.U8nDSapbSnP.vrBI83v40RRafRiwRBkqWvCN/.L8ciS";
        boolean flag = passwordEncoder.matches("123456", ciphertext);
        System.out.println(flag);


    }


}

